//> using options -experimental

@addClass def foo(): Unit =
  println("macro generated main")
  println("executed in: " + (new Throwable().getStackTrace().head.getClassName))
//> object Baz$macro$1 {
//>   def run() =
//>     println("macro generated main")
//>     println("executed in: " + getClass.getName)
//> }
//> def foo(): Unit =
//>   Baz$macro$1.run

@addClass def bar(): Unit =
  println("macro generated main")
  println("executed in: " + (new Throwable().getStackTrace().head.getClassName))
//> object Baz$macro$2 {
//>   def run() =
//>     println("macro generated main")
//>     println("executed in: " + getClass.getName)
//> }
//> def foo(): Unit =
//>   Baz$macro$2.run

object Bar:
  def run() = ()

@main def Test(): Unit =
  foo()
  bar()
